# -*- coding: utf-8 -*-
# @Time    : 2024/04/12 16:37
# @Author  : Mr.su
# @FileName: connects.py
# @FileDesc: 
import redis, pymongo
from CollectSpiders.settings import REDIS_CONFIG


class RedisClient(object):
    # 连接redis
    def __init__(self):
        self.pool = redis.ConnectionPool(**REDIS_CONFIG)

    @property
    def conn(self):
        if not hasattr(self, '_conn'):
            self.get_conn()
        return self._conn

    def get_conn(self): self._conn = redis.Redis(connection_pool=self.pool)
